package cn.com.dhc.danlu.fragment;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import cn.com.dhc.danlu.R;
import cn.com.dhc.danlu.fragment.base.BaseActivePhoneFragment;

/**
 * @author wuhaiyang
 */
public class InputPhoneActiveFragment extends BaseActivePhoneFragment {
    public InputPhoneActiveFragment () {}

    public static InputPhoneActiveFragment newInstance (String phone) {
        InputPhoneActiveFragment fragment = new InputPhoneActiveFragment ();
        Bundle bundle = new Bundle ();
        bundle.putString ("phone", phone);
        fragment.setArguments (bundle);
        return fragment;
    }

    @Override
    protected View createView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate (R.layout.fragment_activephone, container, false);
    }

    @Override
    public void onViewCreated (View view, Bundle savedInstanceState) {
        super.onViewCreated (view, savedInstanceState);
        Bundle bundle = getArguments ();
        if (null != bundle) {
            String phone = bundle.getString ("phone");
            if (!TextUtils.isEmpty (phone)) {
                et_phone.setText (phone);
                et_phone.setSelection (phone.length ());
            }
        }
    }

    @Override
    public void onActivityCreated (Bundle savedInstanceState) {
        super.onActivityCreated (savedInstanceState);
    }

    @Override
    public void reGetSmsCode () {
        super.reGetSmsCode ();
        setDisAllowInputPhone (true);
    }
}